import React from 'react'
import{ Text, View, Button } from 'react-native'
import { NavigationContext } from '@react-navigation/native';

export default class My extends React.Component {
  static contextType = NavigationContext;

  render() {
    // We can access navigation object via context
    const navigation = this.context;

    return (
      <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
        <Text style={{ fontSize: 30 }}>my</Text>
        <Button
          onPress={() => navigation.navigate('Main')}
          title="go to Main"
        />
      </View>
    )
  }
}